{% extends 'base.html' %}

{% block title %}登录{% endblock %}

{% block content %}
<div class="row justify-content-center mt-5">
    <div class="col-md-6 col-lg-4">
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h3 class="text-center">用户登录</h3>
            </div>
            <div class="card-body">
                {% if form.errors %}
                <div class="alert alert-danger">
                    用户名或密码错误！
                </div>
                {% endif %}

                <form method="post">
                    {% csrf_token %}

                    <div class="mb-3">
                        {{ form.username.label_tag }}
                        {{ form.username }}
                    </div>

                    <div class="mb-3">
                        {{ form.password.label_tag }}
                        {{ form.password }}
                    </div>

                    <button type="submit" class="btn btn-primary w-100">登录</button>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}